﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Liquifier;

namespace LiquifierTest
{

    public partial class LiquiferAttributesTest
    {
        [Liquifiable]
        public class AnObject
        {
            public AnObject obj;
            public AnObject obj2;
            public int value;
        }

        [TestMethod()]
        public void Are_Statistics_Accurate()
        {
            AnObject one = new AnObject();
            one.obj = new AnObject();
            one.obj.obj = new AnObject();   //three objects
            one.obj.obj.obj = one.obj.obj;
            one.obj2 = one;                 //two references

            //and three objects == three values

            var info = Liquifer.Liquify(one, new MemoryStream());

            Assert.AreEqual(3, info.ObjectCount);
            Assert.AreEqual(3, info.ValueCount);
            Assert.AreEqual(2, info.ReferenceCount);

        }

    }
}
